﻿#ifndef FORMCONFIGTRDP_H
#define FORMCONFIGTRDP_H

#include <QStandardItemModel>
#include <QTimer>
#include <QWidget>
#include <Tool/qxlsxhelper.h>
#include <Tool/trdpConfig.h>
#include"Tool/tcpclient.h"
namespace Ui {
class FormConfigTRDP;
}

class FormConfigTRDP : public QWidget
{
    Q_OBJECT

public:
    explicit FormConfigTRDP(QWidget *parent = nullptr);
    ~FormConfigTRDP();
    void SetTCPServerInfo(const QString& strip,const QString& strPort);

private:
    void connectAllSlots();
    void OnLogMsg(const QString &logmsg);
    void Readconfig(const QString &configSheetName);
    void ShowTRDPConfigData();

    void closeEvent(QCloseEvent*event)override;
private slots:
    void on_btn_connect_Clicked();
    void on_btn_disconnect_Clicked();
    void on_btn_configSel_Clicked();
    void on_btn_configSend_Clicked();
    void on_btn_cardInit_Clicked();
    void HandleTimer();
private:
    Ui::FormConfigTRDP *ui;
    TcpClient _client;
    QTimer _timer;
    QVector<TRDPconfig> _trdpCongigs;       //trdp 配置内容
    qxlsxHelper xlsxhelper;             //excel文件读写接口
    QString _configSheetName;
    QStandardItemModel* _model=nullptr;
};

#endif // FORMCONFIGTRDP_H
